// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    list: [{
      name:"人人都会",
      price:122
    },{
      name:"人人应该会",
      price:188
    },{
      name:"人人都不会",
      price:0
    }]
  },


  // 事件处理函数

onfilter(info){
  let ont= []
  let list = [{
    name:"人人都会",
    price:122
  },{
    name:"人人应该会",
    price:188
  },{
    name:"人人都不会",
    price:0
  }]
  let len = list.leng
  for (let index = 0; index < list.length; index++) {
    if (info == 'cost') {
      if (list[index].price > 0) {
      ont.push(list[index]);
      }
    }else{
      if (list[index].price == 0) {
        ont.push(list[index]);

        }
    }
  }
this.setData({
  list:ont
})
},
free(){
  this.onfilter()
},
cone(){
  this.onfilter("cost")
},
})
